#pragma once

#include <libtcod\libtcod.hpp>
#include <memory>
#include <string>

typedef std::shared_ptr<TCODParser> TCODParserPtr;

namespace CfgParsers
{
	namespace Engine
	{
		struct ParseData
		{
			unsigned int width;
			unsigned int height;
			float near_clip;
			float far_clip;

			ParseData() : width(0), height(0), near_clip(1.0f), far_clip(1000.0f) {}
		};

		class CfgParser: public ITCODParserListener
		{
		public:
			virtual ~CfgParser();

			static void run(const TCODParserPtr &cfg_parser, const std::string &cfg_path, ParseData &data);

			bool parserNewStruct(TCODParser *parser,const TCODParserStruct *str,const char *name);
			bool parserFlag(TCODParser *parser,const char *name);
			bool parserProperty(TCODParser *parser,const char *name, TCOD_value_type_t vtype, TCOD_value_t value);
			bool parserEndStruct(TCODParser *parser,const TCODParserStruct *str, const char *name);
			void error(const char *msg);

		private:
			CfgParser(ParseData &data);

			ParseData &data;
		};
	}
}